package cn.codergege.kotlinclass.classandinheritance

import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest
class SomeClassesTest {
    @Test fun testConstruct() {
        val person = Person("codergege", null)
        assertEquals("codergege", person.name)
        assertNull(person.age)

        val jack = Person("Jack")
        assertEquals("Jack", jack.name)
        assertNull(jack.age)
    }

    @Test fun testInitOrder() {
        val obj = InitOrderDemo("hello")
    }

    @Test fun testSencondaryConstructor() {
        val tomcat = Cat("tom")
        assertEquals(0, tomcat.age)
        val jackcat = Cat("jack", 2)
        assertEquals(2, jackcat.age)
    }
}